package com.jessica.learnio;

import java.util.*;

public class InputNumbersSortAndQuery {
    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        int[] a;
        a = new int[10];
        int buf;
        System.out.print("请输入十个数字");
        for (int i = 0; i < a.length; i++) {
            a[i] = reader.nextInt();
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length - i - 1; j++) {
                if (a[j] > a[j + 1]) {
                    buf = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = buf;
                }
            }
        }
        System.out.print("请输入要输出的个数");
        buf = reader.nextInt();
        System.out.print(a[buf - 1]);
    }
}